home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / CardServices.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  32KB  |  881 lines

  1. /*
  2.      File:        CardServices.h
  3.  
  4.      Contains:    The client interface to Card and Socket Services.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __CARDSERVICES__
  19. #define __CARDSERVICES__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __PCCARDTUPLES__
  25. #include <PCCardTuples.h>
  26. #endif
  27. #ifndef __MIXEDMODE__
  28. #include <MixedMode.h>
  29. #endif
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. #if PRAGMA_IMPORT_SUPPORTED
  36. #pragma import on
  37. #endif
  38.  
  39. #if PRAGMA_ALIGN_SUPPORTED
  40. #pragma options align=mac68k
  41. #endif
  42.  
  43. /*    miscellaneous*/
  44.  
  45. enum {
  46.     CS_MAX_SOCKETS                = 32                            /* a long is used as a socket bitmap*/
  47. };
  48.  
  49. /* Will move to <Gestalt.h>*/
  50.  
  51. enum {
  52.     gestaltCardServicesAttr        = 'pccd',                        /* Card Services attributes*/
  53.     gestaltCardServicesPresent    = 0,                            /* if set, Card Services is present*/
  54.     gestaltCardServicesSupportsRequestIO = 1                    /* if set, CSRequest/ReleaseIO are supported*/
  55. };
  56.  
  57. /* Will move to <Traps.h>*/
  58.  
  59. enum {
  60.     _PCCardDispatch                = 0xAAF0                        /* Card Services entry trap*/
  61. };
  62.  
  63. /*
  64.  Will move to <Errors.h>
  65.     result codes
  66. */
  67.  
  68. enum {
  69.     kCSBadAdapterErr            = -9050,                        /* invalid adapter number*/
  70.     kCSBadAttributeErr            = -9051,                        /* specified attributes field value is invalid*/
  71.     kCSBadBaseErr                = -9052,                        /* specified base system memory address is invalid*/
  72.     kCSBadEDCErr                = -9053,                        /* specified EDC generator specified is invalid*/
  73.     kCSBadIRQErr                = -9054,                        /* specified IRQ level is invalid*/
  74.     kCSBadOffsetErr                = -9055,                        /* specified PC card memory array offset is invalid*/
  75.     kCSBadPageErr                = -9056,                        /* specified page is invalid*/
  76.     kCSBadSizeErr                = -9057,                        /* specified size is invalid*/
  77.     kCSBadSocketErr                = -9058,                        /* specified logical or physical socket number is invalid*/
  78.     kCSBadTypeErr                = -9059,                        /* specified window or interface type is invalid*/
  79.     kCSBadVccErr                = -9060,                        /* specified Vcc power level index is invalid*/
  80.     kCSBadVppErr                = -9061,                        /* specified Vpp1 or Vpp2 power level index is invalid*/
  81.     kCSBadWindowErr                = -9062,                        /* specified window is invalid*/
  82.     kCSBadArgLengthErr            = -9063,                        /* ArgLength argument is invalid*/
  83.     kCSBadArgsErr                = -9064,                        /* values in argument packet are invalid*/
  84.     kCSBadHandleErr                = -9065,                        /* clientHandle is invalid*/
  85.     kCSBadCISErr                = -9066,                        /* CIS on card is invalid*/
  86.     kCSBadSpeedErr                = -9067,                        /* specified speed is unavailable*/
  87.     kCSReadFailureErr            = -9068,                        /* unable to complete read request*/
  88.     kCSWriteFailureErr            = -9069,                        /* unable to complete write request*/
  89.     kCSGeneralFailureErr        = -9070,                        /* an undefined error has occurred*/
  90.     kCSNoCardErr                = -9071,                        /* no PC card in the socket*/
  91.     kCSUnsupportedFunctionErr    = -9072,                        /* function is not supported by this implementation*/
  92.     kCSUnsupportedModeErr        = -9073,                        /* mode is not supported*/
  93.     kCSBusyErr                    = -9074,                        /* unable to process request at this time - try later*/
  94.     kCSWriteProtectedErr        = -9075,                        /* media is write-protected*/
  95.     kCSConfigurationLockedErr    = -9076,                        /* a configuration has already been locked*/
  96.     kCSInUseErr                    = -9077,                        /* requested resource is being used by a client*/
  97.     kCSNoMoreItemsErr            = -9078,                        /* there are no more of the requested item*/
  98.     kCSOutOfResourceErr            = -9079                            /* Card Services has exhausted the resource*/
  99. };
  100.  
  101. /*    messages sent to client's event handler*/
  102.  
  103. enum {
  104.     kCSNullMessage                = 0x00,                            /* no messages pending (not sent to clients)*/
  105.     kCSCardInsertionMessage        = 0x01,                            /* card has been inserted into the socket*/
  106.     kCSCardRemovalMessage        = 0x02,                            /* card has been removed from the socket*/
  107.     kCSCardLockMessage            = 0x03,                            /* card is locked into the socket with a mechanical latch*/
  108.     kCSCardUnlockMessage        = 0x04,                            /* card is no longer locked into the socket*/
  109.     kCSCardReadyMessage            = 0x05,                            /* card is ready to be accessed*/
  110.     kCSCardResetMessage            = 0x06,                            /* physical reset has completed*/
  111.     kCSInsertionRequestMessage    = 0x07,                            /* request to insert a card using insertion motor*/
  112.     kCSInsertionCompleteMessage    = 0x08,                            /* insertion motor has finished inserting a card*/
  113.     kCSEjectionRequestMessage    = 0x09,                            /* user or other client is requesting a card ejection*/
  114.     kCSEjectionFailedMessage    = 0x0A,                            /* eject failure due to electrical/mechanical problems*/
  115.     kCSPMResumeMessage            = 0x0B,                            /* power management resume (TBD)*/
  116.     kCSPMSuspendMessage            = 0x0C,                            /* power management suspend (TBD)*/
  117.     kCSResetPhysicalMessage        = 0x0D,                            /* physical reset is about to occur on this card*/
  118.     kCSResetRequestMessage        = 0x0E,                            /* physical reset has been requested by a client*/
  119.     kCSResetCompleteMessage        = 0x0F,                            /* ResetCard() background reset has completed*/
  120.     kCSBatteryDeadMessage        = 0x10,                            /* battery is no longer useable, data will be lost*/
  121.     kCSBatteryLowMessage        = 0x11,                            /* battery is weak and should be replaced*/
  122.     kCSWriteProtectMessage        = 0x12,                            /* card is now write protected*/
  123.     kCSWriteEnabledMessage        = 0x13,                            /* card is now write enabled*/
  124.     kCSClientInfoMessage        = 0x14,                            /* client is to return client information*/
  125.     kCSSSUpdatedMessage            = 0x15,                            /* AddSocketServices/ReplaceSocket services has changed SS support*/
  126.     kCSFunctionInterruptMessage    = 0x16,                            /* card function interrupt*/
  127.     kCSAccessErrorMessage        = 0x17,                            /* client bus errored on access to socket*/
  128.     kCSCardUnconfiguredMessage    = 0x18,                            /* a CARD_READY was delivered to all clients and no client */
  129.                                                                 /*    requested a configuration for the socket*/
  130.     kCSStatusChangedMessage        = 0x19                            /* status change for cards in I/O mode*/
  131. };
  132.  
  133. /*
  134.     The following is a mapping of the PCMCIA name space to the Macintosh name space.
  135.     These two enum lists will be removed and given to developers as a separate file.
  136. */
  137.  
  138. enum {
  139.     SUCCESS                        = noErr,
  140.     BAD_ADAPTER                    = kCSBadAdapterErr,
  141.     BAD_ATTRIBUTE                = kCSBadAttributeErr,
  142.     BAD_BASE                    = kCSBadBaseErr,
  143.     BAD_EDC                        = kCSBadEDCErr,
  144.     BAD_IRQ                        = kCSBadIRQErr,
  145.     BAD_OFFSET                    = kCSBadOffsetErr,
  146.     BAD_PAGE                    = kCSBadPageErr,
  147.     BAD_SIZE                    = kCSBadSizeErr,
  148.     BAD_SOCKET                    = kCSBadSocketErr,
  149.     BAD_TYPE                    = kCSBadTypeErr,
  150.     BAD_VCC                        = kCSBadVccErr,
  151.     BAD_VPP                        = kCSBadVppErr,
  152.     BAD_WINDOW                    = kCSBadWindowErr,
  153.     BAD_ARG_LENGTH                = kCSBadArgLengthErr,
  154.     BAD_ARGS                    = kCSBadArgsErr,
  155.     BAD_HANDLE                    = kCSBadHandleErr,
  156.     BAD_CIS                        = kCSBadCISErr,
  157.     BAD_SPEED                    = kCSBadSpeedErr,
  158.     READ_FAILURE                = kCSReadFailureErr,
  159.     WRITE_FAILURE                = kCSWriteFailureErr,
  160.     GENERAL_FAILURE                = kCSGeneralFailureErr,
  161.     NO_CARD                        = kCSNoCardErr,
  162.     UNSUPPORTED_FUNCTION        = kCSUnsupportedFunctionErr,
  163.     UNSUPPORTED_MODE            = kCSUnsupportedModeErr,
  164.     BUSY                        = kCSBusyErr,
  165.     WRITE_PROTECTED                = kCSWriteProtectedErr,
  166.     CONFIGURATION_LOCKED        = kCSConfigurationLockedErr,
  167.     IN_USE                        = kCSInUseErr,
  168.     NO_MORE_ITEMS                = kCSNoMoreItemsErr,
  169.     OUT_OF_RESOURCE                = kCSOutOfResourceErr
  170. };
  171.  
  172. /*    messages sent to client's event handler*/
  173.  
  174. enum {
  175.     NULL_MESSAGE                = kCSNullMessage,
  176.     CARD_INSERTION                = kCSCardInsertionMessage,
  177.     CARD_REMOVAL                = kCSCardRemovalMessage,
  178.     CARD_LOCK                    = kCSCardLockMessage,
  179.     CARD_UNLOCK                    = kCSCardUnlockMessage,
  180.     CARD_READY                    = kCSCardReadyMessage,
  181.     CARD_RESET                    = kCSCardResetMessage,
  182.     INSERTION_REQUEST            = kCSInsertionRequestMessage,
  183.     INSERTION_COMPLETE            = kCSInsertionCompleteMessage,
  184.     EJECTION_REQUEST            = kCSEjectionRequestMessage,
  185.     EJECTION_FAILED                = kCSEjectionFailedMessage,
  186.     PM_RESUME                    = kCSPMResumeMessage,
  187.     PM_SUSPEND                    = kCSPMSuspendMessage,
  188.     RESET_PHYSICAL                = kCSResetPhysicalMessage,
  189.     RESET_REQUEST                = kCSResetRequestMessage,
  190.     RESET_COMPLETE                = kCSResetCompleteMessage,
  191.     BATTERY_DEAD                = kCSBatteryDeadMessage,
  192.     BATTERY_LOW                    = kCSBatteryLowMessage,
  193.     WRITE_PROTECT                = kCSWriteProtectMessage,
  194.     WRITE_ENABLED                = kCSWriteEnabledMessage,
  195.     CLIENT_INFO                    = kCSClientInfoMessage,
  196.     SS_UPDATED                    = kCSSSUpdatedMessage,
  197.     FUNCTION_INTERRUPT            = kCSFunctionInterruptMessage,
  198.     ACCESS_ERROR                = kCSAccessErrorMessage,
  199.     CARD_UNCONFIGURED            = kCSCardUnconfiguredMessage,
  200.     STATUS_CHANGED                = kCSStatusChangedMessage
  201. };
  202.  
  203. /*----------------        CSAccessConfigurationRegister    ----------------*/
  204. struct AccessConfigurationRegisterPB {
  205.     UInt16                             socket;                        /*  -> global socket number*/
  206.     UInt8                             action;                        /*  -> read/write*/
  207.     UInt8                             offset;                        /*  -> offset from config register base*/
  208.     UInt8                             value;                        /* <-> value to read/write*/
  209.     UInt8                             padding[1];                    /* */
  210. };
  211. typedef struct AccessConfigurationRegisterPB AccessConfigurationRegisterPB;
  212.  
  213. /*    `action' field values*/
  214.  
  215. enum {
  216.     kCSReadConfigRegister        = 0x00,
  217.     kCSWriteConfigRegister        = 0x01
  218. };
  219.  
  220. /*----------------        CSGetCardServicesInfo            ----------------*/
  221. struct GetCardServicesInfoPB {
  222.     UInt8                             signature[2];                /* <-  two ascii chars 'CS'*/
  223.     UInt16                             count;                        /* <-  total number of sockets installed*/
  224.     UInt16                             revision;                    /* <-  BCD*/
  225.     UInt16                             csLevel;                    /* <-  BCD*/
  226.     UInt16                             reserved;                    /*  -> zero*/
  227.     UInt16                             vStrLen;                    /* <-> in: client's buffer size, out: vendor string length*/
  228.     UInt8 *                            vendorString;                /* <-> in: pointer to buffer to hold CS vendor string (zero-terminated)*/
  229.                                                                 /*      out: CS vendor string copied to buffer*/
  230. };
  231. typedef struct GetCardServicesInfoPB GetCardServicesInfoPB;
  232.  
  233. /*
  234. ----------------        CSGetClientInfo                    ----------------
  235.  upper byte of attributes is kCSClientInfoSubfunction
  236. */
  237. struct ClientInfoParam {
  238.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  239.     UInt16                             attributes;                    /* <-> subfunction + bitmapped client attributes*/
  240.     UInt16                             revision;                    /* <-  BCD value of client's revision*/
  241.     UInt16                             csLevel;                    /* <-  BCD value of CS release*/
  242.     UInt16                             revDate;                    /* <-  revision date: y[15-9], m[8-5], d[4-0]*/
  243.     SInt16                             nameLen;                    /* <-> in: max length of client name string, out: actual length*/
  244.     SInt16                             vStringLen;                    /* <-> in: max length of vendor string, out: actual length*/
  245.     UInt8 *                            nameString;                    /* <-  pointer to client name string (zero-terminated)*/
  246.     UInt8 *                            vendorString;                /* <-  pointer to vendor string (zero-terminated)*/
  247. };
  248. typedef struct ClientInfoParam ClientInfoParam;
  249.  
  250. /*
  251.  upper byte of attributes is kCSCardNameSubfunction,
  252.                                kCSCardTypeSubfunction,
  253.                                kCSHelpStringSubfunction
  254. */
  255. struct AlternateTextStringParam {
  256.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  257.     UInt16                             attributes;                    /* <-> subfunction + bitmapped client attributes*/
  258.     UInt16                             socket;                        /*  -> logical socket number*/
  259.     UInt16                             reserved;                    /*  -> zero*/
  260.     SInt16                             length;                        /* <-> in: max length of string, out: actual length*/
  261.     UInt8 *                            text;                        /* <-  pointer to string (zero-terminated)*/
  262. };
  263. typedef struct AlternateTextStringParam AlternateTextStringParam;
  264.  
  265. /* upper byte of attributes is kCSCardIconSubfunction*/
  266. struct AlternateCardIconParam {
  267.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  268.     UInt16                             attributes;                    /* <-> subfunction + bitmapped client attributes*/
  269.     UInt16                             socket;                        /*  -> logical socket number*/
  270.     Handle                             iconSuite;                    /* <-  handle to icon suite containing all icons*/
  271. };
  272. typedef struct AlternateCardIconParam AlternateCardIconParam;
  273.  
  274. /* upper byte of attributes is kCSActionProcSubfunction*/
  275. struct CustomActionProcParam {
  276.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  277.     UInt16                             attributes;                    /* <-> subfunction + bitmapped client attributes*/
  278.     UInt16                             socket;                        /*  -> logical socket number*/
  279. };
  280. typedef struct CustomActionProcParam CustomActionProcParam;
  281.  
  282. struct GetClientInfoPB {
  283.     union {
  284.         ClientInfoParam                 clientInfo;
  285.         AlternateTextStringParam         alternateTextString;
  286.         AlternateCardIconParam             alternateIcon;
  287.         CustomActionProcParam             customActionProc;
  288.     }                                 u;
  289. };
  290. typedef struct GetClientInfoPB GetClientInfoPB;
  291.  
  292. /*    `attributes' field values*/
  293.  
  294. enum {
  295.     kCSMemoryClient                = 0x0001,
  296.     kCSIOClient                    = 0x0004,
  297.     kCSClientTypeMask            = 0x0007,
  298.     kCSShareableCardInsertEvents = 0x0008,
  299.     kCSExclusiveCardInsertEvents = 0x0010,
  300.     kCSInfoSubfunctionMask        = 0xFF00,
  301.     kCSClientInfoSubfunction    = 0x0000,
  302.     kCSCardNameSubfunction        = 0x8000,
  303.     kCSCardTypeSubfunction        = 0x8100,
  304.     kCSHelpStringSubfunction    = 0x8200,
  305.     kCSCardIconSubfunction        = 0x8300,
  306.     kCSActionProcSubfunction    = 0x8400
  307. };
  308.  
  309. /*
  310. ----------------        CSGetConfigurationInfo            ----------------
  311. ----------------        CSModifyConfiguration            ----------------
  312. ----------------        CSRequestConfiguration            ----------------
  313. */
  314. struct GetModRequestConfigInfoPB {
  315.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  316.     UInt16                             socket;                        /*  -> logical socket number*/
  317.     UInt16                             attributes;                    /* <-> bitmap of configuration attributes*/
  318.     UInt8                             vcc;                        /* <-> Vcc setting*/
  319.     UInt8                             vpp1;                        /* <-> Vpp1 setting*/
  320.     UInt8                             vpp2;                        /* <-> Vpp2 setting*/
  321.     UInt8                             intType;                    /* <-> interface type (memory or memory+I/O)*/
  322.     UInt32                             configBase;                    /* <-> card base address of configuration registers*/
  323.     UInt8                             status;                        /* <-> card status register setting, if present*/
  324.     UInt8                             pin;                        /* <-> card pin register setting, if present*/
  325.     UInt8                             copy;                        /* <-> card socket/copy register setting, if present*/
  326.     UInt8                             configIndex;                /* <-> card option register setting, if present*/
  327.     UInt8                             present;                    /* <-> bitmap of which configuration registers are present*/
  328.     UInt8                             firstDevType;                /* <-  from DeviceID tuple*/
  329.     UInt8                             funcCode;                    /* <-  from FuncID tuple*/
  330.     UInt8                             sysInitMask;                /* <-  from FuncID tuple*/
  331.     UInt16                             manufCode;                    /* <-  from ManufacturerID tuple*/
  332.     UInt16                             manufInfo;                    /* <-  from ManufacturerID tuple*/
  333.     UInt8                             cardValues;                    /* <-  valid card register values*/
  334.     UInt8                             padding[1];                    /* */
  335. };
  336. typedef struct GetModRequestConfigInfoPB GetModRequestConfigInfoPB;
  337.  
  338. /*    `attributes' field values*/
  339.  
  340. enum {
  341.     kCSExclusivelyUsed            = 0x0001,
  342.     kCSEnableIREQs                = 0x0002,
  343.     kCSVccChangeValid            = 0x0004,
  344.     kCSVpp1ChangeValid            = 0x0008,
  345.     kCSVpp2ChangeValid            = 0x0010,
  346.     kCSValidClient                = 0x0020,
  347.     kCSSleepPower                = 0x0040,                        /* request that power be applied to socket during Sleep*/
  348.     kCSLockSocket                = 0x0080,
  349.     kCSTurnOnInUse                = 0x0100
  350. };
  351.  
  352. /*    `intType' field values*/
  353.  
  354. enum {
  355.     kCSMemoryInterface            = 0x01,
  356.     kCSMemory_And_IO_Interface    = 0x02
  357. };
  358.  
  359. /*    `present' field values*/
  360.  
  361. enum {
  362.     kCSOptionRegisterPresent    = 0x01,
  363.     kCSStatusRegisterPresent    = 0x02,
  364.     kCSPinReplacementRegisterPresent = 0x04,
  365.     kCSCopyRegisterPresent        = 0x08
  366. };
  367.  
  368. /*    `cardValues' field values*/
  369.  
  370. enum {
  371.     kCSOptionValueValid            = 0x01,
  372.     kCSStatusValueValid            = 0x02,
  373.     kCSPinReplacementValueValid    = 0x04,
  374.     kCSCopyValueValid            = 0x08
  375. };
  376.  
  377. /*
  378. ----------------        CSGetClientEventMask            ----------------
  379. ----------------        CSSetClientEventMask            ----------------
  380. */
  381. struct GetSetClientEventMaskPB {
  382.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  383.     UInt16                             attributes;                    /* <-> bitmap of attributes*/
  384.     UInt16                             eventMask;                    /* <-> bitmap of events to be passed to client for this socket*/
  385.     UInt16                             socket;                        /*  -> logical socket number*/
  386. };
  387. typedef struct GetSetClientEventMaskPB GetSetClientEventMaskPB;
  388.  
  389. /*    `attributes' field values*/
  390.  
  391. enum {
  392.     kCSEventMaskThisSocketOnly    = 0x0001
  393. };
  394.  
  395. /*    `eventMask' field values*/
  396.  
  397. enum {
  398.     kCSWriteProtectEvent        = 0x0001,
  399.     kCSCardLockChangeEvent        = 0x0002,
  400.     kCSEjectRequestEvent        = 0x0004,
  401.     kCSInsertRequestEvent        = 0x0008,
  402.     kCSBatteryDeadEvent            = 0x0010,
  403.     kCSBatteryLowEvent            = 0x0020,
  404.     kCSReadyChangeEvent            = 0x0040,
  405.     kCSCardDetectChangeEvent    = 0x0080,
  406.     kCSPMChangeEvent            = 0x0100,
  407.     kCSResetEvent                = 0x0200,
  408.     kCSSSUpdateEvent            = 0x0400,
  409.     kCSFunctionInterrupt        = 0x0800,
  410.     kCSAllEvents                = 0xFFFF
  411. };
  412.  
  413. /*
  414. ----------------        CSGetFirstClient                ----------------
  415. ----------------        CSGetNextClient                    ----------------
  416. */
  417. struct GetClientPB {
  418.     UInt32                             clientHandle;                /* <-  clientHandle for this client*/
  419.     UInt16                             socket;                        /*  -> logical socket number*/
  420.     UInt16                             attributes;                    /*  -> bitmap of attributes*/
  421. };
  422. typedef struct GetClientPB GetClientPB;
  423.  
  424. /*    `attributes' field values*/
  425.  
  426. enum {
  427.     kCSClientsForAllSockets        = 0x0000,
  428.     kCSClientsThisSocketOnly    = 0x0001
  429. };
  430.  
  431. /*
  432. ----------------        CSGetFirstTuple                    ----------------
  433. ----------------        CSGetNextTuple                    ----------------
  434. ----------------        CSGetTupleData                    ----------------
  435. */
  436. struct GetTuplePB {
  437.     UInt16                             socket;                        /*  -> logical socket number*/
  438.     UInt16                             attributes;                    /*  -> bitmap of attributes*/
  439.     UInt8                             desiredTuple;                /*  -> desired tuple code value, or $FF for all*/
  440.     UInt8                             tupleOffset;                /*  -> offset into tuple from link byte*/
  441.     UInt16                             flags;                        /* <-> internal use*/
  442.     UInt32                             linkOffset;                    /* <-> internal use*/
  443.     UInt32                             cisOffset;                    /* <-> internal use*/
  444.  
  445.     union {
  446.         struct {
  447.             UInt8                             tupleCode;            /* <-  tuple code found*/
  448.             UInt8                             tupleLink;            /* <-  link value for tuple found*/
  449.         }                                 TuplePB;
  450.  
  451.         struct {
  452.             UInt16                             tupleDataMax;        /*  -> maximum size of tuple data area*/
  453.             UInt16                             tupleDataLen;        /* <-  number of bytes in tuple body*/
  454.             TupleBody                         tupleData;            /* <-  tuple data*/
  455.         }                                 TupleDataPB;
  456.     }                                 u;
  457. };
  458. typedef struct GetTuplePB GetTuplePB;
  459.  
  460. /*    `attributes' field values*/
  461.  
  462. enum {
  463.     kCSReturnLinkTuples            = 0x0001
  464. };
  465.  
  466. /*
  467. ----------------        CSRequestSocketMask                ----------------
  468. ----------------        CSReleaseSocketMask                ----------------
  469. */
  470. struct ReqRelSocketMaskPB {
  471.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  472.     UInt16                             socket;                        /*  -> logical socket*/
  473.     UInt16                             eventMask;                    /*  -> bitmap of events to be passed to client for this socket*/
  474. };
  475. typedef struct ReqRelSocketMaskPB ReqRelSocketMaskPB;
  476.  
  477. /*
  478.     `eventMask' field values (see above for Get/SetClientEventMask
  479. ----------------        CSGetStatus                        ----------------
  480. */
  481. struct GetStatusPB {
  482.     UInt16                             socket;                        /*  -> logical socket number*/
  483.     UInt16                             cardState;                    /* <-  current state of installed card*/
  484.     UInt16                             socketState;                /* <-  current state of the socket*/
  485. };
  486. typedef struct GetStatusPB GetStatusPB;
  487.  
  488. /*    `cardState' field values*/
  489.  
  490. enum {
  491.     kCSWriteProtected            = 0x0001,
  492.     kCSCardLocked                = 0x0002,
  493.     kCSEjectRequest                = 0x0004,
  494.     kCSInsertRequest            = 0x0008,
  495.     kCSBatteryDead                = 0x0010,
  496.     kCSBatteryLow                = 0x0020,
  497.     kCSReady                    = 0x0040,
  498.     kCSCardDetected                = 0x0080
  499. };
  500.  
  501. /*    `socketState' field values*/
  502.  
  503. enum {
  504.     kCSWriteProtectChanged        = 0x0001,
  505.     kCSCardLockChanged            = 0x0002,
  506.     kCSEjectRequestPending        = 0x0004,
  507.     kCSInsertRequestPending        = 0x0008,
  508.     kCSBatteryDeadChanged        = 0x0010,
  509.     kCSBatteryLowChanged        = 0x0020,
  510.     kCSReadyChanged                = 0x0040,
  511.     kCSCardDetectChanged        = 0x0080
  512. };
  513.  
  514. /*
  515. ----------------        CSModifyWindow                    ----------------
  516. ----------------        CSReleaseWindow                    ----------------
  517. ----------------        CSRequestWindow                    ----------------
  518. */
  519. struct ReqModRelWindowPB {
  520.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  521.     UInt32                             windowHandle;                /* <-> window descriptor*/
  522.     UInt16                             socket;                        /*  -> logical socket number*/
  523.     UInt16                             attributes;                    /*  -> window attributes (bitmap)*/
  524.     UInt32                             base;                        /* <-> system base address*/
  525.     UInt32                             size;                        /* <-> memory window size*/
  526.     UInt8                             accessSpeed;                /*  -> window access speed (bitmap)*/
  527.                                                                 /*        (not applicable for I/O mode)*/
  528.     UInt8                             padding[1];                    /* */
  529. };
  530. typedef struct ReqModRelWindowPB ReqModRelWindowPB;
  531.  
  532. /*    `attributes' field values*/
  533.  
  534. enum {
  535.     kCSMemoryWindow                = 0x0001,
  536.     kCSIOWindow                    = 0x0002,
  537.     kCSAttributeWindow            = 0x0004,                        /* not normally used by Card Services clients*/
  538.     kCSWindowTypeMask            = 0x0007,
  539.     kCSEnableWindow                = 0x0008,
  540.     kCSAccessSpeedValid            = 0x0010,
  541.     kCSLittleEndian                = 0x0020,                        /* configure socket for little endianess*/
  542.     kCS16BitDataPath            = 0x0040,
  543.     kCSWindowPaged                = 0x0080,                        /* */
  544.     kCSWindowShared                = 0x0100,
  545.     kCSWindowFirstShared        = 0x0200,                        /* */
  546.     kCSWindowProgrammable        = 0x0400                        /* */
  547. };
  548.  
  549. /*    `accessSpeed' field values*/
  550.  
  551. enum {
  552.     kCSDeviceSpeedCodeMask        = 0x07,
  553.     kCSSpeedExponentMask        = 0x07,
  554.     kCSSpeedMantissaMask        = 0x78,
  555.     kCSUseWait                    = 0x80,
  556.     kCSAccessSpeed250nsec        = 0x01,
  557.     kCSAccessSpeed200nsec        = 0x02,
  558.     kCSAccessSpeed150nsec        = 0x03,
  559.     kCSAccessSpeed100nsec        = 0x04,
  560.     kCSExtAccSpeedMant1pt0        = 0x01,
  561.     kCSExtAccSpeedMant1pt2        = 0x02,
  562.     kCSExtAccSpeedMant1pt3        = 0x03,
  563.     kCSExtAccSpeedMant1pt5        = 0x04,
  564.     kCSExtAccSpeedMant2pt0        = 0x05,
  565.     kCSExtAccSpeedMant2pt5        = 0x06,
  566.     kCSExtAccSpeedMant3pt0        = 0x07,
  567.     kCSExtAccSpeedMant3pt5        = 0x08,
  568.     kCSExtAccSpeedMant4pt0        = 0x09,
  569.     kCSExtAccSpeedMant4pt5        = 0x0A,
  570.     kCSExtAccSpeedMant5pt0        = 0x0B,
  571.     kCSExtAccSpeedMant5pt5        = 0x0C,
  572.     kCSExtAccSpeedMant6pt0        = 0x0D,
  573.     kCSExtAccSpeedMant7pt0        = 0x0E,
  574.     kCSExtAccSpeedMant8pt0        = 0x0F,
  575.     kCSExtAccSpeedExp1ns        = 0x00,
  576.     kCSExtAccSpeedExp10ns        = 0x01,
  577.     kCSExtAccSpeedExp100ns        = 0x02,
  578.     kCSExtAccSpeedExp1us        = 0x03,
  579.     kCSExtAccSpeedExp10us        = 0x04,
  580.     kCSExtAccSpeedExp100us        = 0x05,
  581.     kCSExtAccSpeedExp1ms        = 0x06,
  582.     kCSExtAccSpeedExp10ms        = 0x07
  583. };
  584.  
  585. /*
  586. ----------------        CSRegisterClient                ----------------
  587. ----------------        CSDeregisterClient                ----------------
  588. */
  589. #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  590. struct ClientCallbackPB {
  591.     UInt16                             message;                    /*  -> which event this is*/
  592.     UInt16                             socket;                        /*  -> logical socket number*/
  593.     UInt16                             info;                        /*  -> function-specific*/
  594.     UInt16                             misc;                        /*  -> function-specific*/
  595.     Ptr                             reserved;                    /*  -> pointer to MTD request block*/
  596.     Ptr                             buffer;                        /*  -> function-specific*/
  597.     Ptr                             clientData;                    /*  -> pointer to client's data (from RegisterClient)*/
  598. };
  599. typedef struct ClientCallbackPB ClientCallbackPB;
  600.  
  601. typedef ClientCallbackPB *ClientCallbackPBPtr;
  602. typedef pascal UInt16 (*PCCardCSClientProcPtr)(ClientCallbackPBPtr ccPBPtr);
  603.  
  604. #if GENERATINGCFM
  605. typedef UniversalProcPtr PCCardCSClientUPP;
  606. #else
  607. typedef PCCardCSClientProcPtr PCCardCSClientUPP;
  608. #endif
  609.  
  610. enum {
  611.     uppPCCardCSClientProcInfo = kPascalStackBased
  612.          | RESULT_SIZE(SIZE_CODE(sizeof(UInt16)))
  613.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ClientCallbackPBPtr)))
  614. };
  615.  
  616. #if GENERATINGCFM
  617. #define NewPCCardCSClientProc(userRoutine)        \
  618.         (PCCardCSClientUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppPCCardCSClientProcInfo, GetCurrentArchitecture())
  619. #else
  620. #define NewPCCardCSClientProc(userRoutine)        \
  621.         ((PCCardCSClientUPP) (userRoutine))
  622. #endif
  623.  
  624. #if GENERATINGCFM
  625. #define CallPCCardCSClientProc(userRoutine, ccPBPtr)        \
  626.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppPCCardCSClientProcInfo, (ccPBPtr))
  627. #else
  628. #define CallPCCardCSClientProc(userRoutine, ccPBPtr)        \
  629.         (*(userRoutine))((ccPBPtr))
  630. #endif
  631. struct RegisterClientPB {
  632.     UInt32                             clientHandle;                /* <-  client descriptor*/
  633.     PCCardCSClientUPP                 clientEntry;                /*  -> universal procPtr to client's event handler*/
  634.     UInt16                             attributes;                    /*  -> bitmap of client attributes*/
  635.     UInt16                             eventMask;                    /*  -> bitmap of events to notify client*/
  636.     Ptr                             clientData;                    /*  -> pointer to client's data*/
  637.     UInt16                             version;                    /*  -> Card Services version this client expects*/
  638. };
  639. typedef struct RegisterClientPB RegisterClientPB;
  640.  
  641. /*
  642.     `attributes' field values (see GetClientInfo)
  643.     kCSMemoryClient                    = 0x0001,
  644.     kCSIOClient                        = 0x0004,
  645.     kCSShareableCardInsertEvents    = 0x0008,
  646.     kCSExclusiveCardInsertEvents    = 0x0010
  647. */
  648. #endif
  649. /*----------------        CSReleaseConfiguration            ----------------*/
  650. struct ReleaseConfigurationPB {
  651.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  652.     UInt16                             socket;                        /*  -> */
  653. };
  654. typedef struct ReleaseConfigurationPB ReleaseConfigurationPB;
  655.  
  656. /*----------------        CSResetCard                        ----------------*/
  657. struct ResetCardPB {
  658.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  659.     UInt16                             socket;                        /*  -> */
  660.     UInt16                             attributes;                    /*  -> xxx*/
  661. };
  662. typedef struct ResetCardPB ResetCardPB;
  663.  
  664. /*----------------        CSValidateCIS                    ----------------*/
  665. struct ValidateCISPB {
  666.     UInt16                             socket;                        /*  -> */
  667.     UInt16                             chains;                        /*  -> whether link/null tuples should be included*/
  668. };
  669. typedef struct ValidateCISPB ValidateCISPB;
  670.  
  671. /*
  672. ----------------        CSRequestIO                        ----------------
  673. ----------------        CSReleaseIO                        ----------------
  674. */
  675. struct ReqRelIOPB {
  676.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  677.     UInt16                             socket;                        /*  -> socket number*/
  678.     UInt16                             reserved;
  679.     UInt16                             basePort1;                    /*    ->    base I/O port for range*/
  680.     UInt8                             numPorts1;                    /*    ->    number of ports (e.g., bytes).*/
  681.     UInt8                             attributes1;                /*    ->    attributes*/
  682.  
  683.     UInt16                             basePort2;                    /*    ->    base I/O port for range*/
  684.     UInt8                             numPorts2;                    /*    ->    number of ports*/
  685.     UInt8                             attributes2;                /*    ->    attributes*/
  686.  
  687.     UInt8                             ioAddrLines;                /*    -> number of I/O lines decoded by card*/
  688.     UInt8                             reserved1;
  689. };
  690. typedef struct ReqRelIOPB ReqRelIOPB;
  691.  
  692. /*----------------        CSVendorSpecific                ----------------*/
  693. struct VendorSpecificPB {
  694.     UInt32                             clientHandle;                /*  -> clientHandle returned by RegisterClient*/
  695.     UInt16                             vsCode;
  696.     UInt16                             socket;
  697.     UInt32                             dataLen;                    /*  -> length of buffer pointed to by vsDataPtr*/
  698.     UInt8 *                            vsDataPtr;                    /*  -> Card Services version this client expects*/
  699. };
  700. typedef struct VendorSpecificPB VendorSpecificPB;
  701.  
  702. /*    `vsCode' field values*/
  703.  
  704. enum {
  705.     vsAppleReserved                = 0x0000,
  706.     vsEjectCard                    = 0x0001,
  707.     vsGetCardInfo                = 0x0002,
  708.     vsEnableSocketEvents        = 0x0003,
  709.     vsGetCardLocationIcon        = 0x0004,
  710.     vsGetCardLocationText        = 0x0005,
  711.     vsGetAdapterInfo            = 0x0006
  712. };
  713.  
  714. /*
  715. ///////////////////////////////////////////////////////////////////////////////////////
  716.     GetAdapterInfo parameter block (vendor-specific call #6)
  717. */
  718. struct GetAdapterInfoPB {
  719.     UInt32                             attributes;                    /* <-  capabilties of socket's adapter*/
  720.     UInt16                             revision;                    /* <-  id of adapter*/
  721.     UInt16                             reserved;                    /* */
  722.     UInt16                             numVoltEntries;                /* <-  number of valid voltage values*/
  723.     UInt8 *                            voltages;                    /* <-> array of BCD voltage values*/
  724. };
  725. typedef struct GetAdapterInfoPB GetAdapterInfoPB;
  726.  
  727. /*    `attributes' field values*/
  728.  
  729. enum {
  730.     kCSLevelModeInterrupts        = 0x00000001,
  731.     kCSPulseModeInterrupts        = 0x00000002,
  732.     kCSProgrammableWindowAddr    = 0x00000004,
  733.     kCSProgrammableWindowSize    = 0x00000008,
  734.     kCSSocketSleepPower            = 0x00000010,
  735.     kCSSoftwareEject            = 0x00000020,
  736.     kCSLockableSocket            = 0x00000040,
  737.     kCSInUseIndicator            = 0x00000080
  738. };
  739.  
  740. /*
  741. ///////////////////////////////////////////////////////////////////////////////////////
  742.     GetCardInfo parameter block (vendor-specific call #2)
  743. */
  744. struct GetCardInfoPB {
  745.     UInt8                             cardType;                    /* <-  type of card in this socket (defined at top of file)*/
  746.     UInt8                             subType;                    /* <-  more detailed card type (defined at top of file)*/
  747.     UInt16                             reserved;                    /* <-> reserved (should be set to zero)*/
  748.     UInt16                             cardNameLen;                /*  -> maximum length of card name to be returned*/
  749.     UInt16                             vendorNameLen;                /*  -> maximum length of vendor name to be returned*/
  750.     UInt8 *                            cardName;                    /*  -> pointer to card name string (read from CIS), or nil*/
  751.     UInt8 *                            vendorName;                    /*  -> pointer to vendor name string (read from CIS), or nil*/
  752. };
  753. typedef struct GetCardInfoPB GetCardInfoPB;
  754.  
  755. /*    GetCardInfo card types*/
  756.  
  757. enum {
  758.     kCSUnknownCardType            = 0,
  759.     kCSMultiFunctionCardType    = 1,
  760.     kCSMemoryCardType            = 2,
  761.     kCSSerialPortCardType        = 3,
  762.     kCSSerialOnlyType            = 0,
  763.     kCSDataModemType            = 1,
  764.     kCSFaxModemType                = 2,
  765.     kCSFaxAndDataModemMask        = (kCSDataModemType | kCSFaxModemType),
  766.     kCSVoiceEncodingType        = 4,
  767.     kCSParallelPortCardType        = 4,
  768.     kCSFixedDiskCardType        = 5,
  769.     kCSUnknownFixedDiskType        = 0,
  770.     kCSATAInterface                = 1,
  771.     kCSRotatingDevice            = (0 << 7),
  772.     kCSSiliconDevice            = (1 << 7),
  773.     kCSVideoAdaptorCardType        = 6,
  774.     kCSNetworkAdaptorCardType    = 7,
  775.     kCSAIMSCardType                = 8,
  776.     kCSNumCardTypes                = 9
  777. };
  778.  
  779. extern pascal OSErr CSVendorSpecific(VendorSpecificPB *pb)
  780.  TWOWORDINLINE(0x7000, 0xAAF0);
  781.  
  782. #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  783. extern pascal OSErr CSRegisterClient(RegisterClientPB *pb)
  784.  TWOWORDINLINE(0x7001, 0xAAF0);
  785.  
  786. extern pascal OSErr CSDeregisterClient(RegisterClientPB *pb)
  787.  TWOWORDINLINE(0x7002, 0xAAF0);
  788.  
  789. #endif
  790. extern pascal OSErr CSGetFirstTuple(GetTuplePB *pb)
  791.  TWOWORDINLINE(0x7003, 0xAAF0);
  792.  
  793. extern pascal OSErr CSGetNextTuple(GetTuplePB *pb)
  794.  TWOWORDINLINE(0x7004, 0xAAF0);
  795.  
  796. extern pascal OSErr CSGetTupleData(GetTuplePB *pb)
  797.  TWOWORDINLINE(0x7005, 0xAAF0);
  798.  
  799. extern pascal OSErr CSGetConfigurationInfo(GetModRequestConfigInfoPB *pb)
  800.  TWOWORDINLINE(0x7006, 0xAAF0);
  801.  
  802. extern pascal OSErr CSGetCardServicesInfo(GetCardServicesInfoPB *pb)
  803.  TWOWORDINLINE(0x7007, 0xAAF0);
  804.  
  805. extern pascal OSErr CSGetStatus(GetStatusPB *pb)
  806.  TWOWORDINLINE(0x7008, 0xAAF0);
  807.  
  808. extern pascal OSErr CSValidateCIS(ValidateCISPB *pb)
  809.  TWOWORDINLINE(0x7009, 0xAAF0);
  810.  
  811. extern pascal OSErr CSGetFirstClient(GetClientPB *pb)
  812.  TWOWORDINLINE(0x700F, 0xAAF0);
  813.  
  814. extern pascal OSErr CSGetNextClient(GetClientPB *pb)
  815.  TWOWORDINLINE(0x7010, 0xAAF0);
  816.  
  817. extern pascal OSErr CSGetClientInfo(GetClientInfoPB *pb)
  818.  TWOWORDINLINE(0x7011, 0xAAF0);
  819.  
  820. extern pascal OSErr CSResetCard(ResetCardPB *pb)
  821.  TWOWORDINLINE(0x7012, 0xAAF0);
  822.  
  823. extern pascal OSErr CSRequestWindow(ReqModRelWindowPB *pb)
  824.  TWOWORDINLINE(0x7013, 0xAAF0);
  825.  
  826. extern pascal OSErr CSModifyWindow(ReqModRelWindowPB *pb)
  827.  TWOWORDINLINE(0x7014, 0xAAF0);
  828.  
  829. extern pascal OSErr CSReleaseWindow(ReqModRelWindowPB *pb)
  830.  TWOWORDINLINE(0x7015, 0xAAF0);
  831.  
  832. extern pascal OSErr CSRequestConfiguration(GetModRequestConfigInfoPB *pb)
  833.  TWOWORDINLINE(0x701B, 0xAAF0);
  834.  
  835. extern pascal OSErr CSModifyConfiguration(GetModRequestConfigInfoPB *pb)
  836.  TWOWORDINLINE(0x701C, 0xAAF0);
  837.  
  838. extern pascal OSErr CSAccessConfigurationRegister(AccessConfigurationRegisterPB *pb)
  839.  TWOWORDINLINE(0x701D, 0xAAF0);
  840.  
  841. extern pascal OSErr CSReleaseConfiguration(ReleaseConfigurationPB *pb)
  842.  TWOWORDINLINE(0x701E, 0xAAF0);
  843.  
  844. extern pascal OSErr CSGetClientEventMask(GetSetClientEventMaskPB *pb)
  845.  TWOWORDINLINE(0x701F, 0xAAF0);
  846.  
  847. extern pascal OSErr CSSetClientEventMask(GetSetClientEventMaskPB *pb)
  848.  TWOWORDINLINE(0x7020, 0xAAF0);
  849.  
  850. extern pascal OSErr CSRequestSocketMask(ReqRelSocketMaskPB *pb)
  851.  TWOWORDINLINE(0x7021, 0xAAF0);
  852.  
  853. extern pascal OSErr CSReleaseSocketMask(ReqRelSocketMaskPB *pb)
  854.  TWOWORDINLINE(0x7022, 0xAAF0);
  855.  
  856. /*
  857.     Additional calls which are required for all I/O clients when running on
  858.     systems which do not reserve dedicated I/O-spaces for each PC Card.
  859. */
  860. extern pascal OSErr CSRequestIO(ReqRelIOPB *pb)
  861.  TWOWORDINLINE(0x7025, 0xAAF0);
  862.  
  863. extern pascal OSErr CSReleaseIO(ReqRelIOPB *pb)
  864.  TWOWORDINLINE(0x7026, 0xAAF0);
  865.  
  866.  
  867. #if PRAGMA_ALIGN_SUPPORTED
  868. #pragma options align=reset
  869. #endif
  870.  
  871. #if PRAGMA_IMPORT_SUPPORTED
  872. #pragma import off
  873. #endif
  874.  
  875. #ifdef __cplusplus
  876. }
  877. #endif
  878.  
  879. #endif /* __CARDSERVICES__ */
  880.  
  881.